{% extends "base.html" %}
{% comment 'header' %}
# This file is part of opentaps Smart Energy Applications Suite (SEAS).

# opentaps Smart Energy Applications Suite (SEAS) is free software:
# you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# opentaps Smart Energy Applications Suite (SEAS) is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public License
# along with opentaps Smart Energy Applications Suite (SEAS).
# If not, see <https://www.gnu.org/licenses/>.
{% endcomment %}

{% load django_tables2 %}
{% load static i18n %}
{% block title %}Meter Financial Value: {{ object.meter_value_id }}{% endblock %}

{% block content %}
<div class="container">

  {% include "core/_breadcrumbs.html" %}

  <div class="card mb-3">
    <div class="card-body">
    {% block inner_content %}
      <h2>Meter Financial Value {{ object.meter_value_id }}</h2>

      <div class="mb-3">
        <div class="row">
          <div class="col-md mb-2"><b>From Date:</b> {{ object.from_datetime }}</div>
          <div class="col-md mb-2"><b>Thru Date:</b> {{ object.thru_datetime }}</div>
        </div>
        <div class="row">
          <div class="col-md mb-2"><b>Source:</b> {{ object.source }}</div>
          <div class="col mb-2"><b>Amount:</b> {{ object.uom.symbol }} {{ object.amount }}</div>
        </div>
        <div class="row">
          <div class="col-md mb-2 mt-4"><i>{{ object.meter_production_type }} with reference {{ object.meter_production_reference }}
        {% if object.meter %}
          using meter <a href="{{ object.meter.get_absolute_url }}">{{ object.meter }}</a>
          {% if object.meter and object.meter.site %}
            at site <a href="{{ object.meter.site.get_absolute_url }}">{{ object.meter.site }}</a>
          {% endif %}
        {% endif %}
           Created at {{ object.created_datetime }}{% if object.created_by_user %} by {{ object.created_by_user }}{% endif %}</div></i>
          </div>
        </div>
      </div>
    {% endblock inner_content %}
    </div>
  </div>

  {% if object.meterfinancialvalueitem_set.exists %}
    {% url 'core:meter_financial_value_items_table' object.meter_value_id as meter_financial_value_item_url %}
    {% include "core/_ajax_table.html" with title="Items" name="financial_value_items" table_url=meter_financial_value_item_url %}
  {% endif %}

</div>
{% endblock content %}
